<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="_token" content="{{ csrf_token() }}"/>
	<title></title>
</head>
<body>
	<h1 style='text-align:center;'>本页面为消息推送页面,切勿关闭!!</h1>
</body>
<script src="/admin/js/jquery.js" type="text/javascript" charset="utf-8"></script>
<script src="http://cdn.bootcss.com/socket.io/1.3.7/socket.io.js"></script>
<script>
// workerman 实时数据接收
var markers2 = [];
var markerClusterer2 = null;
var data_stuts = false;
$(document).ready(function(){
    // 连接服务端
    var socket = io('http://lot.iqykj.com:2120');
    // 连接后登录
   	uid = "";
    // 用户登录后,告诉后台有有用户登录
    socket.on('connect', function()
    {
    	socket.emit('login', uid);
    });
    // 后端推送来消息时 执行此方法
    socket.on('new_msg', function(msg)
    {
		var msg_data;
		var rule = /&quot;/g;
        var str_json = msg.replace(rule,'"');
        // alert(str_json);
        // msg_data = jQuery.parseJSON(str_json);
		$.ajax(
	    {
			type:"post",
			url:"/admin/message_push/create",
			async:false,
			headers: {'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')},
			data:{Jstr:str_json},
			dataType:"html",
			success:function(jstr)
			{ // 如果ajax请求成功,执行此方法
				// console.log(jstr);
			}
		});
	});
});
</script>
</html>